/*
*    Phantom v2.0 GUI Automation Software
*    Copyright (C) 2009  John C. Van Arsdall (john@phantomtest.com)
*
*    This program is free software; you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation; either version 2 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License along
*    with this program; if not, write to the Free Software Foundation, Inc.,
*    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
// FunctionInput.cpp: implementation of the CFunctionInput class.
//
//////////////////////////////////////////////////////////////////////

#include "ssi_functioninput.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CFunctionInput::CFunctionInput(ssi_stream* an_input, ssi_stream* an_output) : 
CScript(an_input, an_output)
{

}

CFunctionInput::~CFunctionInput()
{

}

void CFunctionInput::SetFunctionName(const String& Name)
{
  SetInputName(Name);
}

SSI_BOOL CFunctionInput::GetNextLine(CScriptLine &Ret)
{
  if(!CurrLine) return 0;
  if(CurrLine->next()){
    CurrLine = CurrLine->next();
    CurrLine->Get(Ret);
    return 1;
  }
  return 0;
}

SSI_BOOL CFunctionInput::AddLine(CScriptLine &aLine)
{
  if(PushLine(aLine)) return 1;
  return 0;
}

SSI_BOOL CFunctionInput::Run(SSI_INT64 Mode, CInterpreter *inInterp)
{
	SSI_BOOL bRet =	CScript::Run(Mode, inInterp);
	ReturnVar = Interp->GetFunctionReturnVar();
  bReturnState = Interp->GetReturnState();
	//bReturnState = 1;  // Returned OK... later want it to exit out if there is an error
	return bRet;
}




